package org.abio.XasML.reflect
{
	import org.abio.XasML.converter.object2Class;
	
	public class MethodInfo extends MetadataAware
	{
		public function MethodInfo()
		{
		}

		internal var _owner:ClassInfo=null;
		public function get owner():ClassInfo{	return this._owner;}
		internal var _bStatic:Boolean=false;
		public function get isStatic():Boolean{	return this._bStatic;}

		internal var name:String=null;
		public function get Name():String{	return this.name;}
		internal var declaredBy:String=null;
		internal var uri:String=null;
		internal var returnType:String=null;
		public function get ReturnType():Class{	return object2Class(this.returnType);}

		internal var parameter:Array=new Array();
		public function get parameters():Array{	return this.parameter;}

		public function invoke(instance:Object, ...args):*{
			if(this.isStatic){
				return (this.owner.defination[this.name] as Function).apply(this.owner, args);
			}else{
				return (instance[this.name] as Function).apply(instance, args);
			} 
		}
	}
}